package com.xtourms.client.ui.util;

import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;

public class MessageBox extends DialogBox {

	public static MessageBox ins = new MessageBox();
	
	private VerticalPanel dialogVPanel;
	
	private MessageBox() {
		setAnimationEnabled(true);
		setAutoHideEnabled(true);
		
		dialogVPanel = new VerticalPanel();
		dialogVPanel.addStyleName("dialogVPanel");
		dialogVPanel.setWidth("300px");
		dialogVPanel.setHeight("200px");
		setWidget(dialogVPanel);
	}

	public void showMessage(String message){
		setText("消息窗口");
		dialogVPanel.clear();
		dialogVPanel.add(new HTML("<span class='message'>"+message+"</span>"));
		center();
	}
	
	public void showWarning(String warning){
		setText("警告");
		dialogVPanel.clear();
		dialogVPanel.add(new HTML("<span class='warning'>"+warning+"</span>"));
		center();
	}
	
	public void showError(String err) {
		setText("错误");
		dialogVPanel.clear();
		dialogVPanel.add(new HTML("<span class='error'>"+err+"</span>"));
		center();
	}

}
